Configure Webhook Reception in Teams

NOTE: This documentation was written based on Microsoft Teams documentation at the time of release. Check Teams for the most current documentation.

Teams has an incoming Webhook feature that does not require authentication. Teams uses a unique secret URL that is associated with a channel of a team. By sending POST requests to this URL with a JSON body that matches the expected schema, SysTrack is able to post messages to Teams.

Limitations

The message size limit is 28 KB. When the size exceeds 28 KB, you receive an error. For more information, see Limits and specifications for Microsoft Teams.

Create Incoming Webhooks for Teams

  1. In Teams, open the channel to add the webhook and select the three dots from the upper-right corner.

  2. Select Connectors from the dropdown menu.

  3. Search for Incoming Webhook and click Add.

  4. Click Configure and enter a name.

  5. (Optional) Upload an image for your webhook.

  6. Copy and save the unique webhook URL from the dialog box. The URL maps to the channel and you can use it to send information to Teams.

  7. Click Done.

    The webhook is now available in the Teams channel.

  8. You can create and send messages through Incoming Webhook or connector for Microsoft 365 Groups. For more information, see Create and send messages.

Webhook Body Template for Teams

Copy and paste this content into the Body section of the Add New Recipient dialog box. Edit as needed.

TIP: For Teams, you need the URL you generated, it must use the POST method, and it needs a body like the one shown below.

{
    "type":"message",
    "attachments": [
        {
            "contentType":"application/vnd.microsoft.card.adaptive",
            "contentUrl":null,
            "content": {
                "type": "AdaptiveCard",
                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
                "version": "1.5",
                "msteams": {
                    "width": "Full"
                },
                "body": [
                    {
                        "type": "TextBlock",
                        "size": "Large",
                        "weight": "Bolder",
                        "text": "@{notificationName}"
                    },
                    {
                        "type": "TextBlock",
                        "size": "Small",
                        "weight": "Bolder",
                        "text": "Activated @{activationTime}",
                        "isSubtle": true,
                        "spacing": "None"
                    },
                    {
                        "type": "Table",
                        "columns": [
                            {
                                "width": "90px"
                            },
                            {
                                "width": 1
                            }
                        ],
                        "rows": [
                            {
                                "type": "TableRow",
                                "cells": [
                                    {
                                        "type": "TableCell",
                                        "items": [
                                            {
                                                "type": "TextBlock",
                                                "text": "Sensor(s)"
                                            }
                                        ]
                            },
                            {
                                "type": "TableCell",
                                "items": [
                                    {
                                        "type": "TextBlock",
                                        "text": "@{sensorNamesUnquoted}",
                                        "weight": "Default",
                                        "wrap": true
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "type": "TableRow",
                        "cells": [
                            {
                                "type": "TableCell",
                                "items": [
                                    {
                                        "type": "TextBlock",
                                        "text": "Group",
                                        "weight": "Bolder"
                                    }
                                ]
                            },
                            {
                                "type": "TableCell",
                                "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "@{groupName}",
                                    "wrap": true
                                }
                            ]
                        }
                    ]
                },
                {
                    "type": "TableRow",
                    "cells": [
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Activation",
                                    "weight": "Bolder"
                                }
                            ]
                        },
                        {
                            "type": "TableCell",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "@{activationThresholdText}",
                                    "wrap": true
                                }
                            ]
                        }
                    ]
                }
                ],
                "showGridLines": false
            },
            {
                "type": "TextBlock",
                "text": "@{notificationDescription}",
                "wrap": true,
                "isSubtle": true
            }
        ],
        "actions": [
            {
                "type": "Action.OpenUrl",
                "title": "Learn More in SysTrack",
                "url": "@{notificationActivationDetailsURL}",
                "role": "button"
            }
        ]
    }
}
]
}